import win32com.client as win32
import os

path = r"./2022.xlsx"

# 启动Excel应用程序
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = False
excel.DisplayAlerts = False

# 打开工作簿
workbook = excel.Workbooks.Open(path, ReadOnly=True)

# 获取工作表第一列的范围
column_range = workbook.Worksheets(1).Range("A:A")
row_count = column_range.Cells.Count

new_var = 1

while new_var <= row_count:
    # 读取单元格的值
    excel_data = workbook.Worksheets(1).Cells(new_var, 1).Value
    
    # 创建文件夹
    new_folder = r"./Tool" + "//" + str(excel_data)
    os.makedirs(new_folder)
    
    new_var += 1

# 关闭工作簿和Excel应用程序
workbook.Close(False)

